home *** CD-ROM | disk | FTP | other *** search
-
- INTERFACE FROM REAL 3D TO CUSTOM DISPLAY DEVICES
- ------------------------------------------------
-
- Contents
- --------
-
- General notes
- The user interface for the custom display
- The library interface for the custom display
- Creating the interface library
-
-
- General notes
- -------------
-
- It is possible to connect a custom display device (frame buffer etc.)
- to Real 3D so that images can be rendered directly to the custom display.
- This kind of direct support can be obtained by creating a simple shared
- library containing some elementary functions.
-
-
-
- The user interface for the custom display
- -----------------------------------------
-
- The custom display is controlled using a set of menu functions in the
- Real 3D's Rendering Control Screen. These menu functions are:
-
-
- Library name
- This function allows the user to define the name of the desired shared
- library. This information is saved to R3D's configuration file when the
- user exits the program.
-
- Open screen
- Tries to obtain access to the custom display. If opening is successful,
- 24 bit rendering is directed to the custom display. The function also
- sets default resolution and display modes.
-
- Close screen
- Frees the custom display. For example, if the access is exclusive (no
- multiple screens supported), other multitasking programs can access the
- display after this.
-
- Set modes
- Allows the user to select desired custom display modes, such as interlace,
- hires, resolution etc. All the options available in the function depend on
- the device used.
-
- 24 bit save
- This function saves the custom display image by reading the image line by
- line and saving it using R3D's own Targa/IFF ILBM saving routines.
-
- Custom save
- This function can be used to save the custom display image in its native
- format instead of the standard 24 bit formats. For example, if the custom
- display is not a true 24 bit display, there are probably more memory
- efficient ways to save the image. Also, the function can be used for
- faster image saving, because line based data transfer in the standard
- 24 bit save function inevitably requires extra data moving and format
- transformations, and is consiquently somewhat slow. Nevertheless, a proper
- implementation of this function is optional; the library may contain a
- non-operational function instead.
-
-
- In addition to the previous functions, most of the other rendering
- controls (Prefs->Aspect ratio, image size etc.) affect the custom display.
-
-
- An example of custom display usage from Real 3D:
-
- - Install the custom display hardware and its driver software to your
- system.
-
- - Copy the R3D-custom display interface library to LIBS: directory.
- The name of this library is usually of the form xxx_r3d.library.
-
- - Activate Real 3D, create a scene and go to solid model by selecting
- Modes->Solid. Select Lampless, Shadowless or Normal rendering mode and
- activate either Targa or IFF 24 option (these selections are automatically
- made if you Projects->Animation->Load the test scene 'TestScene' included
- in the disk).
-
- - Select the rightmost menu 'Frame buffer' of the rendering
- control screen and the first function 'Library name' of it. Then type
- the name of of the interface library and select OK.
-
- - If the hardware is successfully installed and the library name string is
- correct, the frame buffer menu contains now all the functions listed above.
-
- - Select Frame buffer->Open screen. If the opening was successfull, the
- resolution fields are updated to show the custom display dimensions.
-
- - You may now try to change the custom display resolution and other such
- properties using the Frame buffer->Set modes function.
-
- - Click Render button. The image should start to appear to the custom
- display. If not, the rendering is probably directed to a hard disk file,
- which can be detected from increased hard disk activity; if this occurs,
- repeat the previous steps to ensure proper installation and usage.
- You can cancel the rendering by clicking the render button again.
-
- - When the image is ready, you can save it by selecting Frame buffer->
- 24 bit save. This asks the name for the image and saves the image in 24 bit
- Targa/IFF format, depending on the option selected when rendering the image.
- You may also try to save the image using the Custom save function, but
- it is possible that the function is not operational. Nevertheless, it is
- harmless to try it.
-
- - When you do not need the custom display any longer, close it using the
- Frame buffer->Close screen menu (of course, the screen is automatically
- closed when the user exits the program).
-
- - For further details of the Custom save format and the features included
- in the Set modes functions, read the readme file of the interface library
- of your custom display device. This file should contain all the hardware
- specific details.
-
-
-
- The library interface for the custom display
- --------------------------------------------
-
- The shared library needed to connect a display hardware product to Real 3D
- must contain the following functions:
-
- R3DInitDspDrv()
- R3DFreeDspDrv(handle)
- R3DSetMode(handle)
- R3DGetSize(handle,x,y)
- R3DWriteLine(handle,buffer,len,x,y)
- R3DReadLine(handle,buffer,len,x,y)
- R3DClsScr(handle,col)
- R3DCustomSave(handle,name,x,y,w,h)
-
-
- Function descriptions:
-
- All the integers in the following descriptions are 32 bit wide.
-
-
- *** NAME
- R3DInitDspDrv -- allocate and initialize a screen on the custom
- display
-
- SYNOPSIS
- int R3DInitDspDrv()
-
- FUNCTION
- Allocates and initialises a custom display and sets default
- display formats. The screen may or may not be cleared when opened;
- it is cleared whenever rendering starts, anyway.
-
- The main purpose of this function is to get access to the custom
- display. After the call, the custom display should be ready to
- receive and send data, to be cleared and to other such manipulations
- needed when rendering images to the custom display.
-
- For example, this function may open the actual library for the
- display device and then open a screen.
-
- After the function, Real 3D asks the resolution for the custom
- display using the R3DGetSize() function and resets image size
- to this resolution.
-
- INPUTS
-
- RESULT
- A non-zero value, if the call was successfull. The value is used
- as a handle, with which the custom display is accessed. Real 3D
- does not utilize multiple custom display screens yet, but this
- may change in the future versions.
-
- SEE ALSO
- R3DFreeDspDrv(), R3DSetMode(), R3DGetSize()
-
-
- *** NAME
- R3DFreeDspDrv -- closes a custom display previously opened
- by a call to R3DInitDspDrv
-
- SYNOPSIS
- void R3DInitDspDrv(int handle)
- A0
-
- FUNCTION
- Frees the custom display access. For example, it may close a
- screen and then close the actual library for the display device.
-
- INPUTS
- handle -- a handle obtained by a call to R3DInitDspDrv
-
- RESULT
-
- SEE ALSO
- R3DInitDspDrv()
-
-
- *** NAME
- R3DSetMode -- Asks and sets display modes, resolution etc.
- properties for the custom display
-
- SYNOPSIS
- void R3DSetMode(int handle)
- A0
-
- FUNCTION
- This function is used to select hardware specific options for
- the custom display device. It should request all the relevant
- options available for the device such as INTERLACE, PAL/NTSC,
- full screen resolution alternatives, display depth etc.
-
- The mode request may be done for example by opening a requester
- on the IntuitionBase->ActiveWindow and by monitoring the UserPort
- of this window. Real 3D's rendering control screen window is
- guaranteed to contain GADGETUP class IDCMP messages. Nevertheless,
- any other screen or method may be used as well. Also, the function
- may be non-operational, if only one display mode and size is
- available.
-
- After getting the mode selections from the user, the custom display
- defined by handle should be modified to fulfill the selections;
- the current image may be cleared, trashed or preserved. After the
- function, Real 3D asks the new full screen resolution
- using the R3DGetSize() function.
-
- INPUTS
- handle -- a handle obtained by a call to R3DInitDspDrv
-
- RESULT
-
- SEE ALSO
- R3DGetSize()
-
-
- *** NAME
- R3DGetSize -- Asks the current full screen resolution of the
- custom display
-
- SYNOPSIS
- void R3DGetSize(int handle,int *x,int *y)
- A0 A1 D0
-
- FUNCTION
- This function is used to find out the full screen resolution
- of the custom display after opening it and after mode selections.
-
- INPUTS
- handle -- a handle obtained by a call to R3DInitDspDrv
- x -- a pointer to 32 bit integer to which the horizontal
- resolution is written
- y -- a pointer to 32 bit integer to which the vertical
- resolution is written
-
- RESULT
-
- SEE ALSO
- R3DSetMode()
-
-
- *** NAME
- R3DWriteLine -- Writes a line of rgba data into the custom display
-
- SYNOPSIS
- void R3DWriteLine(int handle,int *buffer,int len,int x,int y)
- A0 A1 A2 D0 D1
-
- FUNCTION
- This function writes one line of data, pointed by the parameter
- buffer, into the custom display. The data is in the form
- rgba rgba ..., four consecutive bytes for each pixel. The fourth
- byte 'a' is for alpha channel; this is not utilized by the current
- Real 3D version, but this may change in the future versions. The
- values for each color channel have range 0-255.
-
- The position of the target line on the custom display is defined
- by the offset parameters x and y, and the length of the line is
- defined by the parameter len.
-
- INPUTS
- handle -- a handle obtained by a call to R3DInitDspDrv
- buffer -- points to 4*len bytes of rgba data to be written
- len -- the number of pixels to be written
- x, y -- offset values from the top left corner
-
- RESULT
-
- SEE ALSO
- R3DReadLine()
-
-
- *** NAME
- R3DReadLine -- Reads a line of rgba data from the custom display
- to a buffer
-
- SYNOPSIS
- void R3DReadLine(int handle,int *buffer,int len,int x,int y)
- A0 A1 A2 D0 D1
-
- FUNCTION
- This function reads the color of len pixels into buffer. The data
- is written in the form rgba rgba ..., four consecutive bytes for
- each pixel. The fourth byte 'a' is for alpha channel; this is not
- utilized by the current Real 3D version, but this may change in the
- future versions. The values for each color channel should be scaled
- to full range 0-255.
-
- The data is read starting from the position (x,y), and the length
- of the line is defined by the parameter len.
-
- INPUTS
- handle -- a handle obtained by a call to R3DInitDspDrv
- buffer -- points to 4*len bytes of buffer area
- len -- the number of pixels to be read
- x, y -- offset values from the top left corner
-
- RESULT
-
- SEE ALSO
- R3DWriteLine()
-
-
- *** NAME
- R3DClsScr -- Clears the custom display
-
- SYNOPSIS
- void R3DClsScr(int handle, int color)
- A0 A1
-
- FUNCTION
- This function clears the color of the custom display to a specified
- color. The color is defined by the parameter 'color' in the form
- rgba, one byte for each color channel.
-
- This function is always called when starting to render an image,
- and therefore it can be used for other device dependent preparations,
- too. After the call, the custom display should be ready to receive
- consecutive R3DWriteLine() data lines.
-
- INPUTS
- handle -- a handle obtained by a call to R3DInitDspDrv
- color -- the background color of the display after the call
-
- RESULT
-
- SEE ALSO
- R3DWriteLine()
-
-
- *** NAME
- R3DCustomSave -- Saves the custom display image
-
- SYNOPSIS
- void R3DCustomSave(int handle,char *name,int x,int y,int w,int h)
- A0 A1 A2 D0 D1 D2
-
- FUNCTION
- This function may be used to save a part of the custom display
- contents. The functionality of R3DCustomSave() is optional,
- because standard 24 bit saving facilities of Real 3D are
- available.
-
- There are two reasons to implement the function: first of all,
- the speed, and secondly, custom formats. There are several display
- devices available, whose picture information can be stored more
- efficiently than when using 24 bit formats.
-
- INPUTS
- handle -- a handle obtained by a call to R3DInitDspDrv
- name -- null-terminated character string for the image file name
- x,y -- the top-left corner of the sub-image to be saved
- w,h -- the size of the sub-image to be saved
-
- RESULT
-
- SEE ALSO
-
-
-
- Creating the interface library for Real 3D
- ------------------------------------------
-
- The functions of the previous chapter may be implemented quite freely.
- For example, there are no special requirements for mode query, custom
- saving, multiple screens or alpha channel usage.
-
- The library may be created quite easily by modifying the example code
- contained in this disk; the rather primitive but sufficient example is
- for interfacing ACS Harlequin frame buffer.
-
- We have used 'xxx_r3d.library' naming convention for interface
- libraries, but this is optional.
-
- The interface library should be documented with a text file, which
- describes the user-visible features of the library, that is, the options
- available in the Set modes function and the Custom save function.
-
- If the function collection documented here seems not to be sufficient,
- please inform Realsoft of the new functions required, so that they can be
- added to the end of the library, and relevant calls can be added into
- the program itself. Also, if this document contains insufficient amount
- of information for creating the library, please do not hesitate contact me:
-
- Realsoft KY
- Attn. Vesa Meskanen
- KP 9, SF-35700 Vilppula
- Finland
-
- tel./fax +358-34-48390
-
-
-
-